package com.saxtest;

import java.io.InputStream;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class TestDemo {

	public static void main(String[] args) throws Exception {
		// 1.实例化SAXParserFactory对象
		SAXParserFactory factory = SAXParserFactory.newInstance();
		// 2.创建解析器
		SAXParser parser = factory.newSAXParser();
		// 3.获取需要解析的文档，生成解析器,最后解析文档
		InputStream in = TestDemo.class.getClassLoader().getResourceAsStream("test2.xml");
		SaxHandler dh = new SaxHandler();
		parser.parse(in, dh);
	}
}